package org.example.myleet.p961;

import java.util.HashSet;

public class Solution {
    public int repeatedNTimes(int[] nums) {
        HashSet<Integer> numSet = new HashSet<>();
        for (int num : nums) {
            if (numSet.contains(num)) {
                return num;
            }
            numSet.add(num);
        }
        return -1;
    }
}
